export default {
    data() {
        return {
            Name: {
                username: '',
                password: ''
            }
        };
    },
    methods: {
        SignIn() {
            console.log(this.Name)

            this.$axios({
                    method: "POST",
                    url: "/api/login",
                    params: {
                        username: this.Name.username,
                        password: this.Name.password
                    }
                })
                .then(res => {
                    console.log(res.data);
                    if (res.data.code == 2000) {
                        const a = JSON.stringify(res.data)
                        localStorage.setItem('key',a);
                        this.$router.push({
                            path: "/",
                        })
                    }else{
                        alert("用户名或密码错误！")
                    }


                })
                .catch(err => {
                    console.error(err)
                });

            // this.Name.username=''
            // this.Name.password=''
        },
        
    },
    // created() {
    // },
};